[Unit]
Description=Kubernetes Kubelet
Documentation=https://github.com/kubernetes/kubernetes
{% if RUNTIME == "containerd" %}
After=containerd.service
Requires=containerd.service
{% else %}
After=docker.service
Requires=docker.service
{% endif %}

[Service]
ExecStart=/usr/local/bin/kubelet \
  --kubeconfig=/etc/kubernetes/kubelet.kubeconfig \
  --config=/etc/kubernetes/kubelet.yaml \
  --network-plugin=cni \
{% if nodename is defined %}
  --hostname-override={{ nodename | lower }} \
{% endif %}
{% if RUNTIME == "containerd" %}
  --container-runtime=remote \
  --runtime-request-timeout=15m \
  --container-runtime-endpoint=unix:///run/containerd/containerd.sock \
{% endif %}
{% if kubelet.extraArgs is defined %}
{% for extraArg in kubelet.extraArgs %}
  {{ extraArg }} \
{% endfor %}
{% endif %}
  --v={{ kubelet.log.level | default(1) }}

Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
